

<div class="alert alert-info alert-fn-valid" style="line-height:26px;" >
    <strong>提示！</strong>您可以在这里上传文件 ：）
    <p>
        Only the following format can be uploaded:
        <strong>.doc, .docx</strong>
    </p>
</div>


<form id="form2" action="" class="form-horizontal" method="post" enctype="multipart/form-data">

    <div class="form-group" id="fileList">                
        
        <div id="divprogresscontainer_Logo" class=" col-sm-12">
        </div>
    </div>
    <div class="form-group"> 
        <div id="divprogressGroup_Logo" class=" col-sm-12">
        </div>
    </div>

    <div class="form-group"> 
        <div class="col-sm-offset-2 col-sm-10">
            <span id="spanButtonPlaceholder_Logo"></span>

            <button id="btnUpload_Logo" class="btn btn-primary btn-margin-left hide" type="button">
              Upload
            </button>
        </div>
    </div>

</form>
<form id="uploadFileForm" role="form" class="form-horizontal" method="post" enctype="multipart/form-data">
    <div class="hide">
        <input type="hidden" id="_id" value=""/>
    </div>

    <div class="form-group" id="fileList">                
        
        <div id="divprogresscontainer" class=" col-sm-12">
        </div>
    </div>
    <div class="form-group"> 
        <div id="divprogressGroup" class=" col-sm-12">
        </div>
    </div>

    <hr/>

    <div class="form-group"> 
        <div class="col-sm-offset-2 col-sm-10">
            <span id="spanButtonPlaceholder_File">
            </span>
            
            <button id="btnUpload" class="btn btn-primary btn-margin-left hide" type="button">
              Upload
            </button>
        </div>
    </div>

</form>



<script type="text/javascript" src="/javascripts/swfupload/swfupload.js"></script>  
<script type="text/javascript" src="/javascripts/swfupload/swfupload.queue.js"></script>  
<script type="text/javascript" src="/javascripts/swfupload/fileprogress.js"></script>  
<script type="text/javascript" src="/javascripts/swfupload/filegroupprogress.js"></script>  
<script type="text/javascript" src="/javascripts/swfupload/handlers.js"></script>  
<script type="text/javascript" src="/javascripts/swfupload/app.js"></script>  

<script type="text/javascript">

var swfu = null;
    var uploadInfo = {
        "Logo": {
            upload_type: "Logo",
            flash_url: baseUrl + "javascripts/swfupload/swfupload.swf",
            flash9_url: baseUrl + "javascripts/swfupload/swfupload_fp9.swf",
            upload_url: baseUrl + "admin/upload",
            post_params:{
                auth_user_id: "userId"
            },

            button_text: '<span class="button">Upload logo</span>',
            button_text_style: '.button{ font-family:Arial;font-size:14px;text-align:center;height:36px; line-height:36px; font-weight:bold; color:#288DB8; display:inline-block; *display:inline; *zoom:1; box-shadow:1px 1px 2px rgba(0,0,0,0.15); }',
            button_disabled: false,  //true 触发mouseclick 事件
            button_action:  SWFUpload.BUTTON_ACTION.SELECT_FILE,   //SELECT_FILE 单选  SELECT_FILES 多选
            file_size_limit: "2 MB",     //kb
            file_upload_limit: 0, //    0 - unlimited
            file_types: "*.jpg;*.png;.jpeg",
            file_types_description: "Files of type",
            button_image_url: baseUrl + "images/flash-button.png",

            is_click_upload: true,
            start_upload_obj: $("#btnUpload_Logo")[0],
            progressTarget: "divprogresscontainer_Logo",
            progressGroupTarget : "divprogressGroup_Logo",
        },
        "File": {
            upload_type: "File",
            flash_url: baseUrl + "javascripts/swfupload/swfupload.swf",
            flash9_url: baseUrl + "javascripts/swfupload/swfupload_fp9.swf",
            upload_url: baseUrl + "admin/upload",
            post_params:{
                auth_user_id: "userId"
            },

            button_text: '<span class="button">Browse files...</span>',
            button_text_style: '.button{ font-family:Arial;font-size:14px;text-align:center;height:36px; line-height:36px; font-weight:bold; color:#288DB8; display:inline-block; *display:inline; *zoom:1; box-shadow:1px 1px 2px rgba(0,0,0,0.15); }',
            button_disabled: false,
            button_action:  SWFUpload.BUTTON_ACTION.SELECT_FILES,   //SELECT_FILE 单选  SELECT_FILES 多选
            file_size_limit: 0,
            file_upload_limit: 0, //    0 - unlimited
            file_types: "*.*",
            file_types_description: "Supported Files",
            button_image_url: baseUrl + "images/flash-button.png",

            is_click_upload: true,
            start_upload_obj: $("#btnUpload")[0],
            progressTarget: "divprogresscontainer",
            progressGroupTarget : "divprogressGroup",
        }
    }

 


    $(function(){
        //速度太快没加载出来flash，不知道为什么？
        setTimeout(function(){
            Flash.init(uploadInfo["File"]);
            Flash.init(uploadInfo["Logo"]);
        }, 1000);
        
    });


    function mouseClick(upload_type){
        if( uploadInfo[upload_type].button_disabled){
            art.tip.danger("暂时不能上传");
            return false;
        }
    }
    function uploadSuccess_Callback(file, serverData){
        console.log("serverData:", serverData)
        serverData = JSON.parse(serverData);
        if(serverData.status == 1){
            art.tip.success("upload success.");
        }
    }
</script>  